var page = sm("do_Page");
var root = ui("$");
var log = require('util/log')
var event = require('config/event')

root.setMapping({
	"header_text.text" : "title",
	"$.tag" : "index",
})

root.on("touch", function() {
	// 点击一个cell再把索引传递回index.ui
	page.fire(event.caseDetail.pageChange, root.tag);
})

root.on('dataRefreshed', function() {
	updatePageState(0)
})

page.on(event.caseDetail.pageChange, updatePageState)

function updatePageState(index){

	if (index == root.tag) {
		ui('header_text').fontColor = "FF9813FF"
		ui('header_state').bgColor = "FF9813FF"
		ui('header_text').fontSize = 34
	} else {
		ui('header_text').fontColor = "28313EFF"
		ui('header_state').bgColor = "FFFFFFFF"
		ui('header_text').fontSize = 30
	}
}
